package com.ternnetwork.cms.controller.file;


import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.ternnetwork.cms.service.file.ImageService;







@Controller@Scope("prototype")
@RequestMapping("/cms/file/image/*")
public class ImageController {
	@Resource
	private ImageService imageService;
	
	
	@RequestMapping("scaling.htm")
	public void scaling(HttpServletResponse response,HttpServletRequest request){
		try{
			ServletOutputStream out = response.getOutputStream();
			byte[] image=imageService.imageScaling(response,request);
			response.setContentLength(image.length);
	        out.write(image);
	        out.close();
		}catch(Exception e){
			e.printStackTrace();
		}
	}
	
	

}
